import baseUrl from './config';
import http from '@/utils/http';

// 操作
export function operator_info(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/operator/info`,
    method: 'POST',
    data: data
  });
}

export function operator_page(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/operator/page`,
    method: 'POST',
    data: data
  });
}

export function operator_roles(id, data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/operator/rolelist/${id}`,
    method: 'POST',
    data: data
  });
}
export function operator_update(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/operator/update`,
    method: 'POST',
    data: data
  });
}

export function operator_add(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/operator/add`,
    method: 'POST',
    data: data
  });
}

export function operator_company(id) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/operator/company/${id}`,
    method: 'GET'
  });
}

export function operator_lock(id, data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/operator/lock/${id}`,
    method: 'POST',
    data: data
  });
}

export function operator_pwdreset(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/operator/pwdrest`,
    method: 'POST',
    data: data
  });
}

export function operator_bind_roles(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/operator/link/operatorwithrole`,
    method: 'POST',
    data: data
  });
}
export function operator_bind_companies(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/company/link/companywithoperator`,
    method: 'POST',
    data: data
  });
}

// 菜单
export function menu_all() {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/menu/all`,
    method: 'POST'
  });
}
export function menu_my() {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/menu/my`,
    method: 'POST'
  });
}
export function menu_add(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/menu/add`,
    method: 'POST',
    data: data
  });
}
export function menu_update(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/menu/update`,
    method: 'POST',
    data: data
  });
}
export function menu_remove(id) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/menu/remove/${id}`,
    method: 'GET'
  });
}

// 权限
export function permission_page(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/action/page`,
    method: 'POST',
    data: data
  });
}

export function permission_add(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/action/add`,
    method: 'POST',
    data: data
  });
}

export function permission_update(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/action/page`,
    method: 'POST',
    data: data
  });
}

export function permission_remove(id, data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/action/remove/${id}`,
    method: 'POST',
    data: data
  });
}

export function permission_all() {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/action/all`,
    method: 'GET'
  });
}

// 角色
export function role_bind_permission(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/role/link/rolewithaction`,
    method: 'POST',
    data: data
  });
}

export function role_bind_menu(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/role/link/rolewithmenu`,
    method: 'POST',
    data: data
  });
}

export function role_menu(id, data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/role/menulist/${id}`,
    method: 'POST',
    data: data
  });
}

export function role_permission(id, data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/role/actionlist/${id}`,
    method: 'POST',
    data: data
  });
}
export function role_all() {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/role/all`,
    method: 'GET'
  });
}
export function role_add(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/role/add`,
    method: 'POST',
    data: data
  });
}
export function role_update(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/role/update`,
    method: 'POST',
    data: data
  });
}
export function role_remove(id) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/role/remove/${id}`,
    method: 'GET'
  });
}
export function role_page(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/role/page`,
    method: 'POST',
    data: data
  });
}

// 字典
export function dictionary_all() {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/dictionary/all`,
    method: 'GET'
  });
}
export function dictionary_add(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/dictionary/add`,
    method: 'POST',
    data: data
  });
}
export function dictionary_update(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/dictionary/edit`,
    method: 'POST',
    data: data
  });
}
export function dictionary_remove(id) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/dictionary/remove/${id}`,
    method: 'GET'
  });
}

export function dictionary_offspring(id) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/dictionary/offspring/${id}`,
    method: 'GET'
  });
}

export function dictionary_tree() {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/dictionary/tree`,
    method: 'GET'
  });
}
// 公司
export function company_all() {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/company/all`,
    method: 'GET'
  });
}
export function company_page(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/company/page`,
    method: 'POST',
    data: data
  });
}
export function company_add(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/company/add`,
    method: 'POST',
    data: data
  });
}
export function company_update(data) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/company/update`,
    method: 'POST',
    data: data
  });
}
export function company_remove(id) {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/company/remove/${id}`,
    method: 'GET'
  });
}
export function company_info() {
  return http({
    url: `${baseUrl.MANAGEMENT}/api/company/info`,
    method: 'GET'
  });
}

